package com.example.config;

public class ResultFactory {
    //成功
    public static Result successful(Object data) {
        return buildResult(ResultCode.SUCCESS, "成功", data);
    }

    //失败
    public static Result fail(String message) {
        return buildResult(ResultCode.FAIL, message, null);
    }

    public static Result buildResult(int ResultCode, String message, Object data) {
        return new Result(ResultCode, message, data);
    }

    public static Result buildResult(ResultCode ResultCode, String message, Object data) {
        return new Result(ResultCode.code, message, data);
    }

    public static Result buildResult(ResultCode ResultCode, String message) {
        return new Result(ResultCode.code, message);
    }
}
